package com.zjt.web;

import com.zjt.entity.factory.FactoryInfo;
import com.zjt.service.IFactoryService;
import com.zjt.web.api.vo.base.PageVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * Created with IntelliJ IDEA.
 * User: xueyanbeijing
 * Date: 12-9-14
 * Time: PM2:38
 * 厂商模块控制器，包括所有与厂商相关的jsp与service之间的处理与跳转
 * To change this template use File | Settings | File Templates.
 */
@Controller
@RequestMapping(value="/web/factory")
public class FactoryController {
    private IFactoryService factoryService;

    @Autowired
    public void setFactoryService(IFactoryService factoryService) {
        this.factoryService = factoryService;
    }


    @RequestMapping(value = "/factorylist", method = RequestMethod.GET)
    private String list(PageVO pageVO,FactoryInfo factoryInfo,Model model){
        pageVO.setPageSize(20);
        Page<FactoryInfo> list = this.factoryService.getFactoryInfoList(pageVO);
        pageVO.setTotalCount(list.getTotalElements());
        model.addAttribute("list",list.getContent());
        model.addAttribute("pageVO",pageVO);
        return "factory/list";
    }
}
